/**
 * Created by levy on 16/6/15.
 */
import DetailForm from './TextDetail';
import Swiper from '../Swiper';

/**
 * @desc 图文详情 [最初用 于工单信息详情]
 * @param [title, tableTitList, imgList, enlargeHandler]
       title: 组件标题
       tableTitList: 表单标题列表 [[后台字段,字段对应要显示的名称]](二维数组)
       imgList: 可滑动的图片, 字符串 'null', 不显示图片
       enlargeHandler: 图片放大
 */
var ImgTextDetail = React.createClass({
    render: function () {
        var dt = this.props.data,
            tit = this.props.title || '',
            imgList = this.props.imgList || dt.picUrl;
        if(!(JSON.stringify(dt)=='{}')){
            return (
                <div className="detail-info">
                    {tit ? <h1>{tit}</h1> : ''}
                    <Swiper imgList={imgList} enlargeHandler={this.props.enlargeHandler} />
                    <DetailForm tableTitList={this.props.tableTitList} data={dt} />
                </div>
            )
        }else{
            return null
        }
    }
});

export default ImgTextDetail;
